home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf.basic;
-
- import com.sun.java.swing.DesktopManager;
- import com.sun.java.swing.JComponent;
- import com.sun.java.swing.JDesktopPane;
- import com.sun.java.swing.JLayeredPane;
- import com.sun.java.swing.SwingUtilities;
- import java.awt.Component;
- import java.awt.Insets;
- import java.awt.Point;
- import java.awt.Rectangle;
- import java.awt.event.MouseAdapter;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseMotionListener;
- import java.beans.PropertyVetoException;
- import java.io.Serializable;
- import java.util.EventObject;
-
- public class BasicDesktopIconUI$MotionListener extends MouseAdapter implements MouseMotionListener, Serializable {
- // $FF: synthetic field
- BasicDesktopIconUI this$0;
- // $FF: renamed from: _x int
- int field_0;
- // $FF: renamed from: _y int
- int field_1;
- int __x;
- int __y;
- Rectangle startingBounds;
-
- public void mouseReleased(MouseEvent e) {
- this.field_0 = 0;
- this.field_1 = 0;
- this.__x = 0;
- this.__y = 0;
- this.startingBounds = null;
- }
-
- public void mousePressed(MouseEvent e) {
- Point p = SwingUtilities.convertPoint((Component)((EventObject)e).getSource(), e.getX(), e.getY(), (Component)null);
- this.__x = e.getX();
- this.__y = e.getY();
- this.field_0 = p.x;
- this.field_1 = p.y;
- this.startingBounds = this.this$0.desktopIcon.getBounds();
-
- try {
- this.this$0.frame.setSelected(true);
- } catch (PropertyVetoException var3) {
- }
-
- if (this.this$0.desktopIcon.getParent() instanceof JLayeredPane) {
- ((JLayeredPane)this.this$0.desktopIcon.getParent()).moveToFront(this.this$0.desktopIcon);
- }
-
- if (e.getClickCount() > 1 && this.this$0.frame.isIconifiable() && this.this$0.frame.isIcon()) {
- this.this$0.deiconize();
- }
-
- }
-
- public void mouseMoved(MouseEvent e) {
- }
-
- public void mouseDragged(MouseEvent e) {
- Point p = SwingUtilities.convertPoint((Component)((EventObject)e).getSource(), e.getX(), e.getY(), (Component)null);
- Insets i = this.this$0.desktopIcon.getInsets();
- int pWidth = ((JComponent)this.this$0.desktopIcon.getParent()).getWidth();
- int pHeight = ((JComponent)this.this$0.desktopIcon.getParent()).getHeight();
- if (this.startingBounds != null) {
- int newX = this.startingBounds.x - (this.field_0 - p.x);
- int newY = this.startingBounds.y - (this.field_1 - p.y);
- if (newX + i.left <= -this.__x) {
- newX = -this.__x - i.left;
- }
-
- if (newY + i.top <= -this.__y) {
- newY = -this.__y - i.top;
- }
-
- if (newX + this.__x + i.right > pWidth) {
- newX = pWidth - this.__x - i.right;
- }
-
- if (newY + this.__y + i.bottom > pHeight) {
- newY = pHeight - this.__y - i.bottom;
- }
-
- JDesktopPane d;
- if ((d = this.this$0.desktopIcon.getDesktopPane()) != null) {
- DesktopManager dm = d.getDesktopManager();
- dm.setBoundsForFrame(this.this$0.desktopIcon, newX, newY, this.this$0.desktopIcon.getWidth(), this.this$0.desktopIcon.getHeight());
- } else {
- this.moveAndRepaint(this.this$0.desktopIcon, newX, newY, this.this$0.desktopIcon.getWidth(), this.this$0.desktopIcon.getHeight());
- }
-
- }
- }
-
- public void moveAndRepaint(JComponent f, int newX, int newY, int newWidth, int newHeight) {
- Rectangle r = ((Component)f).getBounds();
- ((Component)f).setBounds(newX, newY, newWidth, newHeight);
- SwingUtilities.computeUnion(newX, newY, newWidth, newHeight, r);
- ((Component)f).getParent().repaint(r.x, r.y, r.width, r.height);
- }
-
- // $FF: synthetic method
- public BasicDesktopIconUI$MotionListener(BasicDesktopIconUI this$0) {
- this.this$0 = this$0;
- }
- }
-